//
//  YHDevice.h
//  YHRongYiTong
//
//  Created by zxl on 2017/11/13.
//  Copyright © 2017年 YH. All rights reserved.
//

#ifndef YHDevice_h
#define YHDevice_h

#define VERTICAL_SCREEN_WIDTH    [UIScreen mainScreen].bounds.size.width    //竖屏宽度
#define VERTICAL_SCREEN_HEIGHT   [UIScreen mainScreen].bounds.size.height   //竖屏高度
#define HORIZONTAL_SCREEN_WIDTH  [UIScreen mainScreen].bounds.size.height  //横屏宽度
#define HORIZONTAL_SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.width //横屏高度


#define VERTICAL_SCREEN_WIDTH_2    ([UIScreen mainScreen].bounds.size.width/2.f)
#define VERTICAL_SCREEN_WIDTH_3    ([UIScreen mainScreen].bounds.size.width/3.f)
#define VERTICAL_SCREEN_WIDTH_4    ([UIScreen mainScreen].bounds.size.width/4.f)
#define VERTICAL_SCREEN_WIDTH_5    ([UIScreen mainScreen].bounds.size.width/5.f)
#define VERTICAL_SCREEN_WIDTH_7    ([UIScreen mainScreen].bounds.size.width/7.f)
#define VERTICAL_SCREEN_WIDTH_8    ([UIScreen mainScreen].bounds.size.width/8.f)

#define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) //是否是运行iOS7系统

#define IS_IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8)

#define IS_IOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9)

#define IS_IOS11  ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11) //是否是运行iOS11系统

#define FontWithSize(fontSize) [UIFont fontWithName:@"Courier New" size:fontSize]

#define WIDTHRATE VERTICAL_SCREEN_WIDTH/375.f //以4.7屏为主

/*判断设备机型*/

#define YH_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPad ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(768, 1024), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPod_HD ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(2048,1536), [[UIScreen mainScreen] currentMode].size) : NO)

#define YH_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

// Status bar height.
#define  YH_StatusBarHeight      (YH_iPhoneX ? 44.f : 20.f)

// Navigation bar height.
#define  YH_NavigationBarHeight  (44.f+YH_StatusBarHeight)

// Tabbar height.
#define  YH_TAB_BAR_HEIGHT         (YH_iPhoneX ? (49.f+34.f) : 49.f)

// Tabbar safe bottom margin.
#define  YH_TabbarSafeBottomMargin         (YH_iPhoneX ? 34.f : 0.f)

// Status bar & navigation bar height.
#define  YH_StatusBarAndNavBarHeight  (YH_iPhoneX ? 88.f : 64.f)


#define  YH_Touch_ID_NAME (YH_iPhoneX?@"面容ID":@"指纹ID")

#define YH_ViewSafeAreInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})

#endif /* YHDevice_h */
